package org.esprit.ocm.server.metier.ec2;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public interface ConsoleServiceAsync
{

    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.server.metier.ec2.ConsoleService
     */
    void getConsoleOutput( java.lang.String instanceId, org.esprit.ocm.dto.impl.ServerDto server, org.esprit.ocm.dto.impl.AwsCredentialsDto credentials, AsyncCallback<com.xerox.amazonws.ec2.ConsoleOutput> callback );


    /**
     * Utility class to get the RPC Async interface from client-side code
     */
    public static final class Util 
    { 
        private static ConsoleServiceAsync instance;

        public static final ConsoleServiceAsync getInstance()
        {
            if ( instance == null )
            {
                instance = (ConsoleServiceAsync) GWT.create( ConsoleService.class );
                ServiceDefTarget target = (ServiceDefTarget) instance;
                target.setServiceEntryPoint( GWT.getModuleBaseURL() + "ConsoleService.rpc" );
            }
            return instance;
        }

        private Util()
        {
            // Utility class should not be instanciated
        }
    }
}
